package mipushdemo.xiaomi.com.diyitonghang.ui.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import java.util.ArrayList;

public class ChannelViewPage extends FragmentPagerAdapter {
    private ArrayList<String> listName;
    private ArrayList<Fragment> listFragment;

    public ChannelViewPage(FragmentManager fm, ArrayList<String> listName, ArrayList<Fragment> listFragment) {
        super(fm);
        this.listName = listName;
        this.listFragment = listFragment;
    }

    @Override
    public Fragment getItem(int position) {
        return listFragment.get(position);
    }

    @Override
    public int getCount() {
        return listFragment==null?0:listFragment.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return listName==null?"":listName.get(position);
    }
}
